package com.activemq.jar.activemqjar.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.config.DefaultJmsListenerContainerFactory;
import org.springframework.jms.listener.DefaultMessageListenerContainer;

import javax.jms.ConnectionFactory;


/**
 * @date 2020/10/8 18:36
 */
@Configuration
public class JmsContainerFactoryConfig {

    @Bean("jmsTopicContainerFactory")
    public DefaultJmsListenerContainerFactory jmsTopicContainerFactory(ConnectionFactory connectionFactory){
        DefaultJmsListenerContainerFactory jmsFactory = new DefaultJmsListenerContainerFactory();
        jmsFactory.setConnectionFactory(connectionFactory);
//       设置对主题的监听
        jmsFactory.setPubSubDomain(true);
        return jmsFactory;
    }
}
